﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test</title>
    <script type="text/javascript" src="AdminTools/ckfinder/ckfinder.js"></script>
	<script type="text/javascript">

    function BrowseServer()
    {
	    // You can use the "CKFinder" class to render CKFinder in a page:
	    var finder = new CKFinder();
	    finder.basePath = "AdminTools/ckfinder";	// The path for the installation of CKFinder (default = "/ckfinder/").
	    finder.selectActionFunction = SetFileField;
	    finder.popup();

	    // It can also be done in a single line, calling the "static"
	    // popup( basePath, width, height, selectFunction ) function:
	    // CKFinder.popup( '../', null, null, SetFileField ) ;
	    //
	    // The "popup" function can also accept an object as the only argument.
	    // CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
    }

    // This is a sample function which is called when a file is selected in CKFinder.
    function SetFileField( fileUrl )
    {
	    document.getElementById( 'txtImage' ).value = fileUrl;
    }
    
	</script>
</head>
<body>
    <form id="frmTest" runat="server">
    <div id="wrapper" style="width:700px; border:1px solid silver;padding:10px;margin:30px auto;">
        <asp:Panel runat="server" ID="pnImage">
                
            <asp:Repeater runat="server" ID="repeaterImage" 
                onitemcommand="repeaterImage_ItemCommand">
                <ItemTemplate>
                    <img src='<%# Container.DataItem %>' width="70" height="70" style="border:1px solid silver"/>
                    <asp:Button runat="server" ID="btDelete" Text="x" CommandArgument="<%# Container.DataItem %>" CommandName="delete"/>
                </ItemTemplate>
            </asp:Repeater>
        
        </asp:Panel>        
                                        
        <asp:TextBox runat="server" ID="txtImage" Width="300px"></asp:TextBox>        
        <input type="button" value="Duyệt Ảnh" onclick="BrowseServer();"/> 
        <asp:Button ID="btAddImage" runat="server" Text="Thêm Ảnh" 
            onclick="btAddImage_Click"/>
        
        <div style="padding-top:20px;">
            <asp:TextBox runat="server" ID="txtLinkImageLast" TextMode="MultiLine" Rows="5" Width="700px"></asp:TextBox>            
            <br />
            <asp:Button runat="server" ID="btSave" Text="Lưu" onclick="btSave_Click"/>
        </div>
    </div>
    </form>
</body>
</html>
